package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.ActivityJoiner;
import com.ruoyi.swimming.mapper.ActivityJoinerMapper;
import com.ruoyi.swimming.service.IActivityJoinerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 活动参与人Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class ActivityJoinerServiceImpl extends ServiceImpl<ActivityJoinerMapper,ActivityJoiner> implements IActivityJoinerService
{
    @Autowired
    private ActivityJoinerMapper activityJoinerMapper;

    /**
     * 查询活动参与人
     * 
     * @param id 活动参与人ID
     * @return 活动参与人
     */
    @Override
    public ActivityJoiner selectActivityJoinerById(Long id)
    {
        return activityJoinerMapper.selectActivityJoinerById(id);
    }

    /**
     * 查询活动参与人列表
     * 
     * @param activityJoiner 活动参与人
     * @return 活动参与人
     */
    @Override
    public List<ActivityJoiner> selectActivityJoinerList(ActivityJoiner activityJoiner)
    {
        return activityJoinerMapper.selectActivityJoinerList(activityJoiner);
    }

    /**
     * 新增活动参与人
     * 
     * @param activityJoiner 活动参与人
     * @return 结果
     */
    @Override
    public int insertActivityJoiner(ActivityJoiner activityJoiner)
    {
        activityJoiner.setCreateTime(DateUtils.getNowDate());
        return activityJoinerMapper.insert(activityJoiner);
    }

    /**
     * 修改活动参与人
     * 
     * @param activityJoiner 活动参与人
     * @return 结果
     */
    @Override
    public int updateActivityJoiner(ActivityJoiner activityJoiner)
    {
        activityJoiner.setUpdateTime(DateUtils.getNowDate());
        return activityJoinerMapper.updateById(activityJoiner);
    }

    /**
     * 批量删除活动参与人
     * 
     * @param ids 需要删除的活动参与人ID
     * @return 结果
     */
    @Override
    public int deleteActivityJoinerByIds(Long[] ids)
    {
        return activityJoinerMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除活动参与人信息
     * 
     * @param id 活动参与人ID
     * @return 结果
     */
    @Override
    public int deleteActivityJoinerById(Long id)
    {
        return activityJoinerMapper.deleteById(id);
    }
}
